<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button onclick="doTry()">点我试试</button>
<script>
    function doTry() {
        //1.创建一个img元素
        let img=document.createElement("img");
        //2.修改元素属性值
        img.src="images/1.png";
        //3.将元素添加到body标签中
        let body=document.querySelector("body");
        body.appendChild(img);
    }
</script>
</body>
</html>